package org.example.util;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.example.domain.PoArriveorderVo;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;

/**
 * @author cgwb6
 * @description TODO
 * @date 2025/7/16 17:46
 */
@Slf4j
public class ListUtil {
    static List<PoArriveorderVo> arriveorderVos;
    static {
        String str = "[\n" +
                "  {\n" +
                "    \"index\": \"1\",\n" +
                "    \"id\": \"YSRK000001\",\n" +
                "    \"weighingNo\": \"BD00000001\",\n" +
                "    \"supplierName\": \"河北钢铁集团\",\n" +
                "    \"packageBuckleHeavy\": 12.35\n" +
                "  },\n" +
                "  {\n" +
                "    \"index\": \"2\",\n" +
                "    \"id\": \"YSRK000002\",\n" +
                "    \"weighingNo\": \"BD00000002\",\n" +
                "    \"supplierName\": \"宝钢股份\",\n" +
                "    \"packageBuckleHeavy\": 18.75\n" +
                "  },\n" +
                "  {\n" +
                "    \"index\": \"3\",\n" +
                "    \"id\": \"YSRK000003\",\n" +
                "    \"weighingNo\": \"BD00000003\",\n" +
                "    \"supplierName\": \"沙钢集团\",\n" +
                "    \"packageBuckleHeavy\": 9.88\n" +
                "  },\n" +
                "  {\n" +
                "    \"index\": \"2\",\n" +
                "    \"id\": \"BSYK000003\",\n" +
                "    \"weighingNo\": \"BN098500L3\",\n" +
                "    \"supplierName\": \"沙钢集团\",\n" +
                "    \"packageBuckleHeavy\": 9.88\n" +
                "  }  \n" +
                "]";
        arriveorderVos = JSON.parseArray(str, PoArriveorderVo.class);
    }

    private static final List<Integer> PRODUCT_LINE_ID_NOT_CHECK_DEPOT = Arrays.asList(2, 18);

    private static final List<Integer> PRODUCT_LINE_ID_CHECK_DEPOT = Arrays.asList(14, 19, 20);
    public static void main(String[] args) {
        String timeRange = "8:30-9:00,9:00-9:30,9:30-10:00";
        String startTime;
        String endTime;
        LocalDate applicationDate = LocalDate.now();
        // 日期范围格式为 8:30-9:00,9:00-9:30,9:30-10:00 拆分
        if (timeRange.contains(",")) {
            String[] arr = timeRange.split(",");
            String start = arr[0].substring(0, arr[0].indexOf('-'));
            String end   = arr[arr.length - 1].substring(arr[arr.length - 1].indexOf('-') + 1);
            startTime = applicationDate + " " + start ;
            endTime = applicationDate +" " + end ;

        } else {
            // 日期范围格式为 8:30-9:00 拆分
            String[] arr = timeRange.split("-");
            startTime = applicationDate + " " + arr[0];
            endTime = applicationDate + " " + arr[1];
        }
        log.info("startTime:{}, endTime:{}", startTime, endTime);

    }
}
